<?php
	#-------------------------------------------------------------#
	# This file is part of the Kumomado - Virtual Window Platform #
	# for PHP. (c) 2009 Tsai, Min Che <tirme0812@gmail.com>       #
	# Please visit http://www.kumomado.org/ for more information. #
	#                                                             #
	# This software is licensed under the GNU License v3. Please  #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#

	/**
	 * @package application/view/
	 * @author Tsai, Min Che
	 * @version 1.0
	 */
	class KumomadoApplicationView extends KumomadoAbstractView {
		public $kui_component;
		public $kui_container;
		private $script_files = array();
		/**
		 * @param string $app_path Application path
		 */
		public function __construct() {
			
		}
		/**
		 * @param string $xsl_file The xsl file path
		 */
		public function layout($xsl_file) {
			if (!file_exists($xsl_file)) {
				$xsl_file = KUMOMADO_APPLICATION_PATH.'layouts'.DIRECTORY_SEPARATOR.$xsl_file;
			}
			if (file_exists($xsl_file)) {
				$this->layout = $xsl_file;
			}
		}
		public function getLayout($xsl_file) {
			$xsl_file = KUMOMADO_APPLICATION_PATH.'layouts'.DIRECTORY_SEPARATOR.$xsl_file;
			if (file_exists($xsl_file)) {
				return $xsl_file;
			}
		}
		public function addScript($script_file) {
			$script_path = KUMOMADO_APPLICATION_PATH.'javascripts'.DIRECTORY_SEPARATOR.$script_file;
			if (file_exists($script_path)) {
				$script_file = KUMOMADO_APPLICATION_REAL_URL.'javascripts/'.$script_file;
				$this->response('Scripts', array($script_file));
			}
		}
		public function RenderScript() {
			$this->response('Scripts', $this->script_files);
		}
		public function output($data_type = 'text') {
			$logger = KumomadoLogger::getInstance();
			$this->response('Logger', $logger->render());
			parent::output($data_type);
		}
	}
?>